﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace LPV_POS.mh_pos.mh_danhmuc
{
    public partial class frmHienThi_BanHang : Form
    {
        public frmHienThi_BanHang()
        {
            InitializeComponent();
        }

        private void frmHienThi_BanHang_Load(object sender, EventArgs e)
        {
            cpublic ocpublic = new cpublic();
            foreach (System.Windows.Forms.Control ctr in this.groupControl1.Controls)
            {
                if (ctr.ToString().IndexOf("System.Windows.Forms.CheckBox") == 0)
                {
                    if (ctr.Name != chk_All1.Name)
                        ((CheckBox)ctr).Checked = ocpublic.Registry_Get(ctr.Name) == "True";
                }
            }
            foreach (System.Windows.Forms.Control ctr in this.groupControl2.Controls)
            {
                if (ctr.ToString().IndexOf("System.Windows.Forms.CheckBox") == 0)
                {
                    if (ctr.Name != chk_All.Name)
                        ((CheckBox)ctr).Checked = ocpublic.Registry_Get(ctr.Name) == "True";
                }
            }
        }

        private void btnLuu_Click(object sender, EventArgs e)
        {
            cpublic ocpublic = new cpublic();
            foreach (System.Windows.Forms.Control ctr in this.groupControl2.Controls)
            {
                if (ctr.ToString().IndexOf("System.Windows.Forms.CheckBox") == 0)
                {
                    if (ctr.Name != chk_All.Name)
                        ocpublic.Registry_Set(ctr.Name, ((CheckBox)ctr).Checked);
                }
            }
            foreach (System.Windows.Forms.Control ctr in this.groupControl1.Controls)
            {
                if (ctr.ToString().IndexOf("System.Windows.Forms.CheckBox") == 0)
                {
                    if (ctr.Name != chk_All1.Name)
                        ocpublic.Registry_Set(ctr.Name, ((CheckBox)ctr).Checked);
                }
            }
            MessageBox.Show("Lưu thành công");
        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void chk_All_CheckedChanged(object sender, EventArgs e)
        {
            foreach (System.Windows.Forms.Control ctr in this.groupControl2.Controls)
            {
                if (ctr.ToString().IndexOf("System.Windows.Forms.CheckBox") == 0)
                {
                    if (ctr.Name != chk_All.Name)
                        ((CheckBox)ctr).Checked = chk_All.Checked;
                }
            }
        }

        private void chk_All1_CheckedChanged(object sender, EventArgs e)
        {
            foreach (System.Windows.Forms.Control ctr in this.groupControl1.Controls)
            {
                if (ctr.ToString().IndexOf("System.Windows.Forms.CheckBox") == 0)
                {
                    if (ctr.Name != chk_All1.Name)
                        ((CheckBox)ctr).Checked = chk_All1.Checked;
                }
            }
        }

        private void lblDatBan_Huy_sodoban_CheckedChanged(object sender, EventArgs e)
        {

        }
    }
}
